<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'curd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="${pageContext.request.contextPath }/scripts/jquery-1.9.1.min.js"></script>
	<script type="text/javascript">
	
	$(function(){
		
		
		/*	$.post("${pageContext.request.contextPath }/testJson",null,function(date){
				if(date!=null){
					for(var i=0;i<date.length;i++){
						alert(date[i].id);
					}
				}
			});	
		}); */
	 $("#testJson").click(function(){
		$.ajax({
		  type: 'POST',
		  url:'${pageContext.request.contextPath }/testJson',
		  data: null,
		  success: function(date){
		  	alert(JSON.stringify(date));//将JSON对象转换成JSON字符串
		  
		  }
		});
		
		
		
	});

});
	</script>
  </head>
  
  <body>
    <a  href="${pageContext.request.contextPath }/emps">显示所有员工信息</a>
    <br><br>
    
    <button id="testJson">返回JSON格式的字符串</button>
    <br><br>
    <form action="${pageContext.request.contextPath }/upload" method="post" enctype="multipart/form-data">
    	Desc:<input type="text" name="desc">
    	File:<input type="file" name="file" />
    	<input type="submit" value="提交">
    
    </form>
    <a  href="${pageContext.request.contextPath }/testExceptionHandlerExceptionResolver?id=1">测试错误信息</a>
    
    
    
  </body>
</html>
